package com.wjy.icu.common.aspect;//package com.wjy.pet.equityCard.common.aspect;
//
//import com.wjy.pet.equityCard.common.config.PetUser;
//import com.wjy.pet.equityCard.common.constant.Constants;
//import com.wjy.pet.equityCard.common.redis.util.RedisUtils;
//import com.wjy.pet.equityCard.common.utils.ServletUtils;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.ibatis.cache.CacheException;
//import org.aspectj.lang.ProceedingJoinPoint;
//import org.aspectj.lang.Signature;
//import org.aspectj.lang.annotation.Around;
//import org.aspectj.lang.annotation.Aspect;
//import org.aspectj.lang.reflect.MethodSignature;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import javax.servlet.http.HttpServletRequest;
//import java.lang.reflect.Method;
//
///**
// * @Description:
// * @author: wangjunyong
// * @date: 2021/1/26 15:51
// */
//@Aspect
//@Component
//@Slf4j
//public class LoginUserAspect {
//    @Autowired
//    private RedisUtils redis;
//
//    @Around("@annotation(com.wjy.pet.equityCard.common.annotation.LoginUser)")
//    public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
//        HttpServletRequest request = ServletUtils.getRequest();
//        String token = request.getHeader("token");
//        PetUser petUser = redis.get(Constants.ACCESS_TOKEN + token, PetUser.class);
////        try {
////            result = joinPoint.proceed();
////        } catch (Throwable throwable) {
////            //有CacheException注解的方法需要抛出异常
////            if (method.isAnnotationPresent(CacheException.class)) {
////                throw throwable;
////            } else {
////                LOGGER.error(throwable.getMessage());
////            }
////        }
//        return petUser;
//    }
//}
